<?php
/**
 * Author：晴天 QQ：1186258278
 * Creation：2020/3/29 12:36
 */
include "../includes/fun.global.php";

if ($conf['Protect'] != '' && isset($conf['Protect']) && empty($_COOKIE['ADMIN_TOKEN']) && empty($_COOKIE[$conf['Protect']])) {
    $pref = explode('/', $_SERVER['REQUEST_URI'])[count(explode('/', $_SERVER['REQUEST_URI'])) - 1];
    $pref = explode('?', $pref)[1];
    if ($pref == $conf['Protect']) {
        setcookie($conf['Protect'], 1);
    } else {
        header('HTTP/1.1 403 No access');
        show_msg('403', '无访问权限！，您的IP：' . userip() . ' 已经记录<br>若您是站长却忘记了目录保护密码,可打开数据库：sky_config，内的Protect参数查看！', 1, 0, 0);
    }
}

include_once(SYSTEM_ROOT . "fun.admin.php");
if (!empty($_COOKIE['ADMIN_TOKEN'])) header("Location:index.php");
$image = background::image();
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>登入 - 站长后台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" type="text/css"
          href="<?= $cdnserver == null ? '../' : $cdnserver ?>assets/layui/css/layui.css"/>
    <link rel="stylesheet" href="/assets/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" href="/assets/layuiadmin/style/login.css" media="all">
    <link rel="stylesheet" href="/assets/admin/css/login.css?t=<?= $accredit['versions'] ?>" media="all">
</head>
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<body style="<?= ($image == false ? 'background-image: linear-gradient(130deg, #fc5c7d, #6a82fb);' : $image) ?>">
<style>
    @media screen and (max-width: 788px) {
        .nbi {
            width: 94% !important;
            margin-top: -3.5em;
        }
    }

    .AdminImageLogin {
        margin: auto;
        display: block;
        box-shadow: 3px 3px 16px #eee;
        border-radius: 0.5em;
    }


</style>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main nbi" style="background-color: white;border-radius: 0.3em;opacity: 0.9;">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2 class="FontColor"><?= $conf['sitename'] ?></h2>
            <p>站长登陆，<?= $conf['sitename'] ?>管理后台</p>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form" id="Content">
            <div id="form" style="display: block">
                <div class="layui-form-item">
                    <label class="layadmin-user-login-icon layui-icon layui-icon-cellphone"></label>
                    <input type="text" name="phone" lay-verify="required" placeholder="请输入已绑定的手机号"
                           class="layui-input">
                </div>
                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="layui-col-xs8">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-vercode"></label>
                            <input type="text" name="vercode" lay-verify="required" placeholder="请输入短信验证码"
                                   class="layui-input">
                        </div>
                        <div class="layui-col-xs4">
                            <a class="layui-btn layui-btn-fluid LgoinBtn" id="PhoneCode"
                               href="javascript:AdminLogin.do_admin_get_mobile_code()">
                                获取验证码
                            </a>
                        </div>
                    </div>
                </div>

                <button class="layui-btn layui-btn-fluid" lay-submit
                        style="background-color: #ff7235" onclick="AdminLogin.do_admin_login_phone_verify()">登 入
                </button>
            </div>

            <div id="Weix" style="display:none ">
                <div class="layui-form-item">
                    <div class="layui-row">
                        <div class="layui-col-xs8">
                            <label class="layadmin-user-login-icon layui-icon layui-icon-vercode"></label>
                            <input type="text" name="token" placeholder="也可输入token值完成验证！"
                                   class="layui-input">
                        </div>
                        <div class="layui-col-xs4">
                            <a class="layui-btn layui-btn-fluid LgoinBtn Token"
                               onclick="AdminLogin.do_admin_login_token()">
                                开始验证
                            </a>
                        </div>
                    </div>
                </div>
                <div class="layuiadmin-card-text WeixText">
                    请尽快输入验证码哦
                </div>
            </div>

            <div class="layui-trans layui-form-item layadmin-user-login-other">
                <label>其他登陆方式</label>
                <i title="微信登陆" onclick="AdminLogin.do_login_wx()"><img src="/assets/img/weix.png" width="28"
                                                                        height="28"/> </i>
                <i title="APP扫码登陆" onclick="AdminLogin.do_login_app()"><img src="/assets/img/app.png" width="28"
                                                                            height="28"/> </i>
                <i title="APP扫码登陆" onclick="AdminLogin.do_login_scan()"><img src="/assets/img/scan.png" width="28"
                                                                             height="28"/> </i>
                <a href="https://cdn.api.ln.cn/api/wxapi/view/login.php" target="_blank"
                   class="layadmin-user-jump-change layadmin-link">登陆云端</a>
            </div>
        </div>
    </div>

    <div class="layui-trans layadmin-user-login-footer">
        <p style="color: white">© 2020 - 2025 <a href="/" style="color: white"
                                                 target="_blank"><?= $conf['sitename'] ?></a></p>
    </div>
</div>

<script src="<?= $cdnserver == null ? '../' : $cdnserver ?>assets/layui/layui.all.js"></script>
<script src="<?= $cdnpublic ?>/jquery/3.4.1/jquery.min.js"></script>
<script src="/assets/admin/js/login.js?t=<?= $accredit['versions'] ?>"></script>
</body>
</html>
